package cn.bugDance.domain.rebate.service.rule.factory;

import cn.bugDance.domain.rebate.model.entity.BehaviorEntity;
import cn.bugDance.domain.rebate.model.entity.DallyBehaviorRebateEntity;
import cn.bugDance.domain.rebate.service.rule.IRuleChain;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

@Component("rebateRuleChainFactory")
@Slf4j
public class RuleChainFactory {

    private Map<String, IRuleChain> ruleChainGroup;

    public RuleChainFactory(Map<String, IRuleChain> ruleChainGroup) {
        this.ruleChainGroup = ruleChainGroup;
    }

    public List<DallyBehaviorRebateEntity> openRuleChain(BehaviorEntity behaviorEntity){
        IRuleChain stateRuleChain = ruleChainGroup.get("stateRuleChain");

        return stateRuleChain.action(behaviorEntity);
    }
}
